﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.WindowsAzure.ServiceRuntime;

namespace BasicClasses
{
    public class QuestionarioDataSource
    {
        private static QuestionarioContext context = new QuestionarioContext();
        private static string tableName = RoleEnvironment.GetConfigurationSettingValue("QuestionarioTable");

        public static IEnumerable<Questionario> SelectAll()
        {
            return context.Questionarios;
        }

        public static void Add(Questionario questionario, string partitionKey) //partitionKey == Pais
        {
            questionario.PartitionKey = partitionKey;
            questionario.RowKey = Guid.NewGuid().ToString();
            context.AddObject(tableName, questionario);
            context.SaveChanges();
        }
    }
}
